package cn.iocoder.yudao.module.student.dal.mysql.collectCompany;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.student.dal.dataobject.collectCompany.CollectCompanyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.student.controller.app.collectCompany.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 收藏企业 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface CollectCompanyMapper extends BaseMapperX<CollectCompanyDO> {

    default PageResult<CollectCompanyDO> selectPage(AppCollectCompanyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CollectCompanyDO>()
                .eqIfPresent(CollectCompanyDO::getCompanyId, reqVO.getCompanyId())
                .eq(CollectCompanyDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(CollectCompanyDO::getCity,reqVO.getCity())
                .betweenIfPresent(CollectCompanyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderBy(CollectCompanyDO.class, PageParam.DEFAULT_SORTING_FIELDS));
    }

    default List<CollectCompanyDO> selectList(AppCollectCompanyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CollectCompanyDO>()
                .eqIfPresent(CollectCompanyDO::getCompanyId, reqVO.getCompanyId())
                .betweenIfPresent(CollectCompanyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(CollectCompanyDO::getId));
    }

    void reduction(@Param("id") Long id);

}
